﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace asMeishi.web.Controllers
{
    using Models;

    public class AccountController : Controller
    {
        //
        // GET: /Account/

        public ActionResult Index()
        {
            return RedirectToAction("LogOn");
        }

        [HttpPost]
        public ActionResult LogOn(string email, string password,string url="/")
        {
            if (userC.login(email, password)) return new RedirectResult(url);

            ViewBag.info = "错误的用户名或密码";
            return View();
        }
        
        public ActionResult LogOff(string url="/")
        {
            userC.logout();
            return new RedirectResult(url);
        }
    }
}
